require(['./config'],() =>{
    require(['template','header','footer'],(template) =>{
       class List{
           constructor(){
            this.getList()
            this.bindEvents()
           }
           getList(){
            // 根据rap2的假数据渲染官方特别服务模块
            $.get('http://rap2api.taobao.org/app/mock/233854/list',resp =>{
                // console.log(resp)
                if(resp.code === 200){
                    const {list} = resp.body
                    $('#perfumeList').html(template('perfumeListTemplate',{list}))
                }
            })
        }
        // 下拉选择框
        bindEvents() {
            $('.dropdown-icon').on('click', () => {
                $('.dropdown-icon').css({ 'transform': 'rotate(180deg)' })
                $('.pull-down').show()
                $(".pull-down li span").each(function () {
                    $(this).on('click', () => {
                        $('.pop_recom .pop_hot').html($(this).text())
                        $('.dropdown-icon').css({ 'transform': 'rotate(0deg)' })
                        setTimeout(function () {
                            $('.pull-down').hide()
                        }, 10)
                    })
                })
                $('.number').on('mouseleave', () => {
                    $('.pull-down').hide()
                    $('.dropdown-icon').css({ 'transform': 'rotate(0deg)' })
                })
            })
        }
       }
       new List()
    })
})